<template>
  <view>
    <web-view
      @binderror="onError"
      @bindload="onReady"
      :webview-styles="webviewStyles"
      :src="url"
    ></web-view>
  </view>
</template>

<script>
export default {
  name: "webview-page",
  onLoad(opt) {
    console.log(opt?.u);
    this.url = decodeURIComponent(opt?.u);
    // if (opt.title) {
    //   this.title = decodeURIComponent(opt.title);
    //   uni.setNavigationBarTitle({
    //     title: this.title,
    //   });
    // }
  },
  data() {
    return {
      url: "",
      title: "",
      webviewStyles: {
        progress: {
          color: "#FF3333",
        },
      },
    };
  },
  methods: {
    onReady(msg) {
      console.log(msg, "ready");
    },
    onError(msg) {
      console.log(msg, "error");
    },
  },
};
</script>

<style></style>
